package com.bravo.mvpkotlin.data

import com.bravo.mvpkotlin.data.source.IDataSource
import io.reactivex.Flowable

/**
 * Created by Administrator on 2017/6/22 0022.
 */
class DataManager (val romate:IDataSource,val local:IDataSource){

    fun getUsers(key:String):Flowable<List<User>>{
       return romate.getUsers(key).onErrorResumeNext( local.getUsers(key)).map { it.items }
    }

    fun  getRepos(path: String) :Flowable<List<Repo>>{
        return  romate.getRepos(path).onErrorResumeNext( local.getRepos(path))
    }
}